package com.yswy.common.enums;

/**
 * 首页映射枚举
 *
 * @author yanwei
 * @since 2023/12/12 16:13
 */
public enum DayOfWeekMapEnum {

    /**
     * 周一
     * */
    MONDAY("星期一"),
    /**
     * The singleton instance for the day-of-week of Tuesday.
     * This has the numeric value of {@code 2}.
     */
    TUESDAY("星期二"),
    /**
     * The singleton instance for the day-of-week of Wednesday.
     * This has the numeric value of {@code 3}.
     */
    WEDNESDAY("星期三"),
    /**
     * The singleton instance for the day-of-week of Thursday.
     * This has the numeric value of {@code 4}.
     */
    THURSDAY("星期四"),
    /**
     * The singleton instance for the day-of-week of Friday.
     * This has the numeric value of {@code 5}.
     */
    FRIDAY("星期五"),
    /**
     * The singleton instance for the day-of-week of Saturday.
     * This has the numeric value of {@code 6}.
     */
    SATURDAY("星期六"),
    /**
     * The singleton instance for the day-of-week of Sunday.
     * This has the numeric value of {@code 7}.
     */
    SUNDAY("星期天");
    ;

    private final String name;

    DayOfWeekMapEnum(String name) {
        this.name = name;
    }

    public String value() {
        return this.name();
    }

    public String getName() {
        return name;
    }

    public static DayOfWeekMapEnum findNameByEnCode(String code) {
        for (DayOfWeekMapEnum enumObject : values()) {
            if (enumObject.name().equals(code)) {
                return enumObject;
            }
        }
        return SUNDAY;
    }
}
